Skip to main content

unexpected element queries found in manifest

AAPT: error: unexpected element <queries> found in <manifest>.

* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> Android resource linking failed
F:\SVN\AnimalTopia\branch-yyy\client\Temp\gradleOut\launcher\build\intermediates\merged_manifests\release\AndroidManifest.xml:48: AAPT: error: unexpected element `<queries>` found in `<manifest>`.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

解决方法:

  1. 打开 Unity 安装目录
E:\Program Files\Unity\2019.4.16f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates\baseProjectTemplate.gradle
  1. classpath 'com.android.tools.build:gradle:3.4.0' 改为 classpath 'com.android.tools.build:gradle:3.4.3'

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

allprojects {
buildscript {
repositories {**ARTIFACTORYREPOSITORY**
google()
jcenter()
}

dependencies {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
classpath 'com.android.tools.build:gradle:3.4.3'
**BUILD_SCRIPT_DEPS**
}
}

repositories {**ARTIFACTORYREPOSITORY**
google()
jcenter()
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}